#include "Scene.h"

Scene::Scene(){
}

Scene::~Scene(){
    for(unsigned int i=0; i<sceneGeometry.size(); i++){
        delete sceneGeometry.at(i);
    }

}

void Scene::setup(){

    //Add two spheres
    Sphere *sphere = new Sphere();
    sphere->add(80.0, Vector3<float>(80.0, 100.0, 150.0));
    sphere->setupMaterial(1.0, 1.0, 1.0);
    sphere->material->setLight(false);
    sphere->material->setDiffuse(0.8);
    sphere->material->setReflection(0.2);
    sphere->material->setRefraction(0.0);
    sceneGeometry.push_back(sphere);

    Sphere *sphere2 = new Sphere();
    sphere2->add(80.0, Vector3<float>(80.0, 300.0, 250.0));
    sphere2->setupMaterial(1.0, 1.0, 0.0);
    sphere2->material->setLight(false);
    sphere2->material->setDiffuse(0.0);
    sphere2->material->setReflection(1.0);
    sceneGeometry.push_back(sphere2);


    //Add five planes
    Plane *plane_back = new Plane();
    plane_back->add(400.0, Vector3<float>(0.0, 0.0, -1.0));
    plane_back->setupMaterial(1.0, 1.0, 1.0);
    plane_back->material->setLight(false);
    plane_back->material->setDiffuse(0.8);
    plane_back->material->setReflection(0.2);
    plane_back->material->setRefraction(0.0);

    Plane *plane_ground = new Plane();
    plane_ground->add(-5.0, Vector3<float>(1.0, 0.0, 0.0));
    plane_ground->setupMaterial(1.0, 1.0, 1.0);
    plane_ground->material->setLight(false);
    plane_ground->material->setDiffuse(0.9);
    plane_ground->material->setReflection(0.1);
    plane_ground->material->setRefraction(0.0);

    Plane *plane_top = new Plane();
    plane_top->add(500.0, Vector3<float>(-1.0, 0.0, 0.0));
    plane_top->setupMaterial(1.0, 1.0, 1.0);
    plane_top->material->setLight(false);
    plane_top->material->setDiffuse(0.9);
    plane_top->material->setReflection(0.1);
    plane_top->material->setRefraction(0.0);


    Plane *plane_right = new Plane();
    plane_right->add(500.0, Vector3<float>(0.0, -1.0, 0.0));
    plane_right->setupMaterial(0.0, 0.0, 1.0);
    plane_right->material->setLight(false);
    plane_right->material->setDiffuse(0.9);
    plane_right->material->setReflection(0.1);
    plane_right->material->setRefraction(0.0);

    Plane *plane_left = new Plane();
    plane_left->add(-10.0, Vector3<float>(0.0, 1.0, 0.0));
    plane_left->setupMaterial(1.0, 0.0, 0.0);
    plane_left->material->setLight(false);
    plane_left->material->setDiffuse(0.9);
    plane_left->material->setReflection(0.1);
    plane_left->material->setRefraction(0.0);

    sceneGeometry.push_back(plane_ground);
    sceneGeometry.push_back(plane_back);
    sceneGeometry.push_back(plane_top);
    sceneGeometry.push_back(plane_right);
    sceneGeometry.push_back(plane_left);


    //Add lights
    Sphere *light = new Sphere();
    light->add(5, Vector3<float>(490.0, 250.0, 300.0));
    light->setupMaterial(0.5, 0.4, 0.5);
    light->material->setLight(true);

    sceneGeometry.push_back(light);

    Sphere *light2 = new Sphere();
    light2->add(5, Vector3<float>(490.0, 350.0, 100.0));
    light2->setupMaterial(0.5, 0.5, 0.4);
    light2->material->setLight(true);

    sceneGeometry.push_back(light2);


    //Set eye position
    eyePos = Vector3<float>(250.0, 250.0, -400.0);





    }
